<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div ui-layout-center">
        <div class="row">
            <div class="col-sm-12 select-info">
                <form id="employee-form">
                    <div class="select-list">
                        <ul>
                            <li>
                                员工名称 ：<input type="text" name="empName"/>
                            </li>
                            <li>
                                员工账号 ：<input type="text" name="empAccount"/>
                            </li>
                            <li>
                                员工状态：<select name="status" th:with="type=${@dict.getType('sys_emp_status')}">
                                <option value="">所有</option>
                                <option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
                            </select>
                            </li>
                            <li>
                                账号状态：<select name="openStatus" th:with="type=${@dict.getType('sys_open_status')}">
                                <option value="">所有</option>
                                <option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
                            </select>
                            </li>
                            <li class="select-time">
                                <label>入职时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <!--<a class="btn btn-primary btn-rounded btn-sm" onclick="reset()"><i class="fa fa-trash"></i>&nbsp;重置</a>-->
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group hidden-xs" id="toolbar" role="group">
                <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="module:employee:add">
                    <i class="fa fa-plus"></i> 新增
                </a>
                <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.removeAll()" shiro:hasPermission="module:employee:remove">
                    <i class="fa fa-trash-o"></i> 删除
                </a>
                <a class="btn btn-success btn-outline btn-rounded" onclick="$.table.exportExcel()" shiro:hasPermission="module:employee:export">
                    <i class="fa fa-download"></i>&nbsp;导出
                </a>

            </div>

            <div class="col-sm-12 select-info table-striped">
                <table id="bootstrap-table" data-mobile-responsive="true"></table>
            </div>
        </div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('module:employee:edit')}]];
        var removeFlag = [[${@permission.hasPermi('module:employee:remove')}]];
        var sexData = [[${@dict.getType('sys_user_sex')}]];
        var empData = [[${@dict.getType('sys_emp_status')}]];
        var openData = [[${@dict.getType('sys_open_status')}]];
        var prefix = ctx + "module/employee"

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                sortName: "createTime",
                sortOrder: "desc",
                modalName: "员工管理",
                search: false,
                showExport: false,// 是否支持导出文件
                showRefresh:false,// 是否显示刷新按钮
                showColumns :false,// 是否显示隐藏某列下拉框
                showToggle:false,// 是否显示详细视图和列表视图的切换按钮
                columns: [{
		            checkbox: true
		        },
				{
					field : 'empId', 
					title : '员工主键',
                    visible:false
				},
                    {
                        field : 'empAccount',
                        title : '员工账号'
                    },
				{
					field : 'empName', 
					title : '员工名称'
				},
                {
                    field : 'empSex',
                    title : '员工性别',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(sexData, value);
                    }
                },
                {
                    field : 'empIdcard',
                    title : '身份证'
                },
				{
					field : 'empBirth', 
					title : '出生日期' 
				},
                {
                    field : 'empEmail',
                    title : '电子邮件'
                },
                {
                    field : 'empMobilephone',
                    title : '联系电话'
                },
                {
                    field : 'status',
                    title : '员工状态',
                    formatter: function(value, row, index) {
                         return $.table.selectDictLabel(empData, value);
                 }
                },
                {
                    field : 'empAddDate',
                    title : '入职时间'
                },
                {
                    field : 'empLeaveDate',
                    title : '离职时间'
                },{
                field : 'openStatus',
                title : '账号状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(openData, value);
                    }
                },


                // {
                 //    field : 'empSocialSecurity',
                 //    title : '社保卡号'
                // },
                // {
                 //    field : 'empBank',
                 //    title : '银行卡号'
                // },
                // {
                 //    field : 'dept.deptName',
                 //    title : '部门'
                // },
                // {
                 //    field : 'empEducation',
                 //    title : '文化程度'
                // },
                // {
                 //    field : 'empMarriage',
                 //    title : '婚姻状况'
                // },
                // {
                 //    field : 'empPolitics',
                 //    title : '政治面貌'
                // },
                // {
                 //    field : 'empNation',
                 //    title : '民族'
                // },
				// {
				// 	field : 'empCurrentAddress',
				// 	title : '现居住地址'
				// },
				// {
				// 	field : 'empProfession',
				// 	title : '员工专业'
				// },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.empId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.empId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        
        function reset() {
            $("#employee-form")[0].reset();
            $.table.search();
        }
    </script>
</body>
</html>